<?
include '../conn.php';
include "t-cookie.php";
$pid=$_SESSION["t-id"];
?>

<!DOCTYPE html>
<html lang="zh">

	<head>
		<meta charset="UTF-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<title>个人资料-教师端</title>
		<link rel="stylesheet" type="text/css" href="../css/htmleaf-demo.css">
		<link rel="stylesheet" type="text/css" href="../css/nav.css">
		<link rel="stylesheet" type="text/css" href="../fonts/iconfont.css">

		<link rel="stylesheet" href="../css/bootstrap-theme.css" />

		<script type="text/javascript" src="../js/jquery.min.js"></script>
		<link rel="stylesheet" href="../css/bootstrap-theme.min.css" />
		<link rel="stylesheet" href="../css/bootstrap.css" />
		<script type="text/javascript" src="../js/bootstrap3.0.3.min.js"></script>
        <link rel="stylesheet" href="../css/info.css"/>


        <style>

        </style>
	</head>
	<body class="bodycolor">

    <nav class="navbar navbar-default navbar-fixed-top" style="clear: left;">
        <div class="container">
            <div class="navbar-right navfont" id="navbar-collapse">
                <p>华软网络技术系毕业管理系统</p>
            </div>
            <a href="t-cookie.php?cookie=out" id="out">退出</a>
        </div>

    </nav>

		<div class="nav topx navbackground-t" id="nav">
			<div>
				<div style="border-bottom:1px solid rgba(255,255,255,.1)"><img src="../img/mini.png"></div>
			</div>
            <ul>
                <li class="nav-item">
                    <a href="t-index.php"><i class="my-icon nav-icon icon_2"></i><span>首页</span><i class="my-icon nav-more"></i></a>

                </li>
                <li class="nav-item">
                    <a href="t-mykt.php"><i class="my-icon nav-icon icon_1"></i><span>我的课题</span><i
                            class="my-icon nav-more"></i></a>
                </li>
                <li class="nav-item">
                    <a href="t-checkproject.php"><i class="my-icon nav-icon icon_6"></i><span>选课核查</span><i
                            class="my-icon nav-more"></i></a>
                </li>
                <li class="nav-item">
                    <a href="#"><i class="my-icon nav-icon icon_3"></i><span>评分评语</span><i class="my-icon nav-more"></i></a>
                    <ul>
                        <li>
                            <a href="t-GuideMark.php"><span>指导评分</span></a>
                        </li>
                        <li>
                            <a href="t-ThesisMark.php"><span>论文评分</span></a>
                        </li>
                        <li>
                            <a href="t-ReplyMark.php"><span>答辩评分</span></a>
                        </li>
                    </ul>
                </li>
                <li class="nav-item">
                    <a href="t-all.php"><i class="my-icon nav-icon icon_6"></i><span>答辩汇总</span><i
                            class="my-icon nav-more"></i></a>

                </li>
                <li class="nav-item">
                    <a href="#"><i class="my-icon nav-icon icon_3"></i><span>资料管理</span><i class="my-icon nav-more"></i></a>
                    <ul>
                        <li>
                            <a href="t-information.php"><span>我的资料</span></a>
                        </li>
                        <li>
                            <a href="t-mystudent.php"><span>我的学生</span></a>
                        </li>

                    </ul>
                </li>
            </ul>
		</div>
        <div class="indexborder">
            <div class="box-inline indexdiv1 panel panel-default auto" align="center">		
					<div class="themepanel">
						<b>基本资料</b>
					</div>
					<div style="clear:both">
						<hr style="border: solid #B2DBA1 1px;"/>
					</div>
					<div class="panel-body">		
						<div class="a">
					        <img  id="avatarPreview" src="../img/教师头像.gif" class="touxiang" title="点击更换图片">
						</div>	
									

							<table class="tab panel panel-default" id="table">	
							<?php
							    //查询语句

					
	 							$sql="select TeacherId,TeacherName,Sex,Tel,Depart,email,QQ from teacher where TeacherId =$pid";
							    $result=mysqli_query($conn,$sql);
							    while($row=mysqli_fetch_array($result))
							    {
							?>							
								<tr class="c">
							    	<td>工号:</td>
							    	<td><input type="text" value="<?php echo $row['TeacherId']?>" id="input"  readonly="readonly" name="TecherId"/></td>
							    </tr>
							    <tr>
							    	<td>&nbsp;</td>
							    	<td>&nbsp;</td>
							    </tr>
							    <tr class="c">
							    	<td>姓名:</td>
							    	<td><input type="text" value="<?php echo $row['TeacherName']?>" id="input1"  readonly="readonly" name="Teachername"/>	</td>
							    </tr>
							    <tr>
							    	<td>&nbsp;</td>
							    	<td>&nbsp;</td>
							    </tr>
							    <tr class="c">
							    	<td>性别:</td>
							         <td><input type="text" value="<?php echo $row['Sex']?>"  id="input2"  readonly="readonly" name="Sex"/></td>
							    </tr>
							    <tr>
							    	<td>&nbsp;</td>
							    	<td>&nbsp;</td>
							    </tr>
							    
							    <tr class="c">
							    	<td>手机:</td>
							    	<td><input type="text" value="<?php echo $row['Tel']?>" id="input3"  readonly="readonly" name="Tel"/></td>
							    </tr>
							    <tr>
							    	<td>&nbsp;</td>
							    	<td>&nbsp;</td>
							    </tr>					
							    <tr class="c">
							    	<td>E-mail:</td>
							    	<td><input type="email" value="<?php echo $row['email']?>" id="input4"  readonly="readonly" name="email"/></td>
							    </tr>
							    <tr>
							    	<td>&nbsp;</td>
							    	<td>&nbsp;</td>
							    </tr>			    						    
							    <tr class="c">
							    	<td>QQ:</td>
							    	<td><input type="text" value="<?php echo $row['QQ']?>" id="input5"  readonly="readonly" name="QQ"/></td>
							    </tr>					    						    
							    <tr>
							    	<td>&nbsp;</td>
							    	<td>&nbsp;</td>
							    </tr>	
							     <tr class="c">
							    	<td>系别:</td>
							    	<td><input type="text" value="<?php echo $row['Depart']?>" id="input6"  readonly="readonly" name="Depart"/></td>
							    </tr>
							    <tr>
							        <td>&nbsp;</td>
							    	<td>&nbsp;</td>
							    </tr>					    
							    <?php 
								}
							    ?>
							    <tr class="d">
							    	<td></td>
							    	<td>
							    		<button id="edit" name="edited" onclick="change()"  style="color:white">修改</button>						    		
							    		<button id="save" name="saved"  value="t-manage" onclick="save(this)"  style="color:white">保存</button>
							    	</td>
							    </tr>
							</table>	

					</div>					
			</div>
        </div>
<!-- 		<footer class="indexfooter container-fluid  bottom"> -->
<!-- 			<p class="footer-p" align="center">地址：广东省广州市从化区经济开发区高技术产业园广从南路548号 | 电话：020－87818918 邮编：510990 | 网站公安备案编号：4401840100050 粤ICP备：05085382号 站长统计</p> -->
<!-- 		</footer> -->
        
     
		
        <script type="text/javascript"></script>
		<script>
			window.jQuery || document.write('<script src="../js/jquery-1.11.0.min.js"><\/script>')
		</script>
		<script type="text/javascript" src="../js/nav.js"></script>
		<script type="text/javascript">
			function change(){
			     document.getElementById("input1").readOnly = false;           
	             document.getElementById("input1").style.border="1px solid #000000";
	             document.getElementById("input2").readOnly = false;           
	             document.getElementById("input2").style.border="1px solid #000000";
	             document.getElementById("input3").readOnly = false;           
	             document.getElementById("input3").style.border="1px solid #000000";
	             document.getElementById("input4").readOnly = false;           
	             document.getElementById("input4").style.border="1px solid #000000";
	             document.getElementById("input5").readOnly = false;           
	             document.getElementById("input5").style.border="1px solid #000000";  
	             document.getElementById("input6").readOnly = false;           
	             document.getElementById("input6").style.border="1px solid #000000";             
			}
		
		    function save(t) {
		        var a=t;
//                alert(a);
		        var b=a.parentNode.parentNode.parentNode.getElementsByTagName("input");

		        var datas=new Array();
		        for(var i = 0; i < b.length; i++) {
		            datas[i]= encodeURI(b[i].value);
		        }

		        var msg = "您真的确定要修改吗？请确认！";
		        if (confirm(msg)==true){
		            $.ajax({
		                type: "GET",
		                url: "manage.php",
		                data: "&TeacherId="+datas[0]+"&TeacherName="+datas[1]+"&Sex="+datas[2]+"&Tel="+datas[3]+
		                      "&email="+datas[4]+"&QQ="+datas[5]+"&Depart="+datas[6]+"&saved=t-change",
		                error:function(msg){
			                return false
			                },
				        success: function(msg){
		                    alert( msg );
		                    myWindow=window.open("t-information.php","_self");
		                }
		            });
		        }

		        for(var i = 0; i < b.length; i++) {
		            b[i].readOnly = true;
		            b[i].style.border = "0";
		        }
		    }
    	</script>

	</body>

</html>
